tri = [[1], [1, 1]]
for i in range(2, 10):
    a = [1]
    n = len(tri[i - 1])
    for j in range(n - 1):
        b = tri[i - 1][j] + tri[i - 1][j + 1]
        a.append(b)
    a.append(1)
    tri.append(a)

print(tri)

